package com.googlecode.cswish.struts;

import java.io.IOException;

import org.apache.log4j.Logger;

import freemarker.template.Template;
import freemarker.template.TemplateModel;

public class FreemarkerResult extends org.apache.struts2.views.freemarker.FreemarkerResult {

	private final static Logger logger = Logger.getLogger(FreemarkerResult.class);
	
	protected boolean preTemplateProcess(Template template, TemplateModel model) throws IOException {
		boolean ret = super.preTemplateProcess(template, model);
		/*
		if (ret) {
			try {
				long t1 = System.currentTimeMillis();
				Environment env = template.createProcessingEnvironment(model, getWriter());
				String locationArg = "/pages/taglib/common.ftl";
				Template includedTemplate = configuration.getTemplate(locationArg, deduceLocale());
				env.include(includedTemplate);
				long t2 = System.currentTimeMillis();
				System.out.println("FreemarkerResult:" + (t2 - t1));
			} catch (TemplateException e) {
				logger.error("auto import common ftl lib", e);
				
				ret = false;
			}
		}*/
		
		return ret;
	}
}
